package com.zhentao.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import lombok.Data;

/**
 * 检测结果表
 * @TableName detection_result
 */
@TableName(value ="detection_result")
@Data
public class DetectionResult implements Serializable {
    /**
     * 检测结果ID
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 任务ID
     */
    private Long taskId;

    /**
     * 图片ID
     */
    private Long imageId;

    /**
     * 检测类型(SCRATCH:划痕,DENT:凹陷,RUST:锈蚀,CRACK:裂纹,MISSING_PART:缺失部件)
     */
    private String detectionType;

    /**
     * 置信度(0-1)
     */
    private BigDecimal confidence;

    /**
     * 检测框X坐标
     */
    private Integer bboxX;

    /**
     * 检测框Y坐标
     */
    private Integer bboxY;

    /**
     * 检测框宽度
     */
    private Integer bboxWidth;

    /**
     * 检测框高度
     */
    private Integer bboxHeight;

    /**
     * 严重程度(LOW:轻微,MEDIUM:中等,HIGH:严重)
     */
    private String severity;

    /**
     * 检测描述
     */
    private String description;

    /**
     * 使用的AI模型
     */
    private String aiModel;

    /**
     * 模型版本
     */
    private String modelVersion;

    /**
     * 处理时间(毫秒)
     */
    private Integer processingTime;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 更新时间
     */
    private Date updateTime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        DetectionResult other = (DetectionResult) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getTaskId() == null ? other.getTaskId() == null : this.getTaskId().equals(other.getTaskId()))
            && (this.getImageId() == null ? other.getImageId() == null : this.getImageId().equals(other.getImageId()))
            && (this.getDetectionType() == null ? other.getDetectionType() == null : this.getDetectionType().equals(other.getDetectionType()))
            && (this.getConfidence() == null ? other.getConfidence() == null : this.getConfidence().equals(other.getConfidence()))
            && (this.getBboxX() == null ? other.getBboxX() == null : this.getBboxX().equals(other.getBboxX()))
            && (this.getBboxY() == null ? other.getBboxY() == null : this.getBboxY().equals(other.getBboxY()))
            && (this.getBboxWidth() == null ? other.getBboxWidth() == null : this.getBboxWidth().equals(other.getBboxWidth()))
            && (this.getBboxHeight() == null ? other.getBboxHeight() == null : this.getBboxHeight().equals(other.getBboxHeight()))
            && (this.getSeverity() == null ? other.getSeverity() == null : this.getSeverity().equals(other.getSeverity()))
            && (this.getDescription() == null ? other.getDescription() == null : this.getDescription().equals(other.getDescription()))
            && (this.getAiModel() == null ? other.getAiModel() == null : this.getAiModel().equals(other.getAiModel()))
            && (this.getModelVersion() == null ? other.getModelVersion() == null : this.getModelVersion().equals(other.getModelVersion()))
            && (this.getProcessingTime() == null ? other.getProcessingTime() == null : this.getProcessingTime().equals(other.getProcessingTime()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
            && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getTaskId() == null) ? 0 : getTaskId().hashCode());
        result = prime * result + ((getImageId() == null) ? 0 : getImageId().hashCode());
        result = prime * result + ((getDetectionType() == null) ? 0 : getDetectionType().hashCode());
        result = prime * result + ((getConfidence() == null) ? 0 : getConfidence().hashCode());
        result = prime * result + ((getBboxX() == null) ? 0 : getBboxX().hashCode());
        result = prime * result + ((getBboxY() == null) ? 0 : getBboxY().hashCode());
        result = prime * result + ((getBboxWidth() == null) ? 0 : getBboxWidth().hashCode());
        result = prime * result + ((getBboxHeight() == null) ? 0 : getBboxHeight().hashCode());
        result = prime * result + ((getSeverity() == null) ? 0 : getSeverity().hashCode());
        result = prime * result + ((getDescription() == null) ? 0 : getDescription().hashCode());
        result = prime * result + ((getAiModel() == null) ? 0 : getAiModel().hashCode());
        result = prime * result + ((getModelVersion() == null) ? 0 : getModelVersion().hashCode());
        result = prime * result + ((getProcessingTime() == null) ? 0 : getProcessingTime().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", taskId=").append(taskId);
        sb.append(", imageId=").append(imageId);
        sb.append(", detectionType=").append(detectionType);
        sb.append(", confidence=").append(confidence);
        sb.append(", bboxX=").append(bboxX);
        sb.append(", bboxY=").append(bboxY);
        sb.append(", bboxWidth=").append(bboxWidth);
        sb.append(", bboxHeight=").append(bboxHeight);
        sb.append(", severity=").append(severity);
        sb.append(", description=").append(description);
        sb.append(", aiModel=").append(aiModel);
        sb.append(", modelVersion=").append(modelVersion);
        sb.append(", processingTime=").append(processingTime);
        sb.append(", createTime=").append(createTime);
        sb.append(", updateTime=").append(updateTime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}